//
//  HKYHttpRequest.swift
//  HKYHttpRequest
//
//  Created by SHANGLU on 16/12/14.
//  Copyright © 2016年 hky.me. All rights reserved.
//

import UIKit
import Alamofire
public typealias Method = Alamofire.Method //请求方式
public typealias ResponseJSON = Response<AnyObject,NSError>
public typealias ResponseData = Response<NSData,NSError>
public typealias ResponseString = Response<String,NSError>
public typealias EncodingType = Alamofire.ParameterEncoding

class HKYHttpRequest<Target:HKYRequestTargetProtocol>{

}

extension HKYHttpRequest{

    func request(target:Target) ->Alamofire.Request{
        let url = target.baseURL.URLByAppendingPathComponent(target.path).absoluteString
        let request = Alamofire.request(target.method, url, parameters: target.parameters, encoding: target.encoding, headers: target.headers)
        return request
    }
    
}